package com.zto.sch.base.normal;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2021-03-29 10:26
 **/
public class ListTest {
    public static void main(String[] args) {
//        String[] arr = {"abc", "ccc", "ddd"};
//        List<String> list = Arrays.asList(arr);
//        arr[0] = "ppp";
//        System.out.println(list);


        List<String> bookList = new ArrayList<>();
        bookList.add("遥远的救世主");
        bookList.add("背叛");
        bookList.add("天幕红尘");
        bookList.add("人生");
        bookList.add("平凡的世界");

        List<String> luyaoBookList = bookList.subList(3, 5);

        System.out.println(bookList);
//        System.out.println(luyaoBookList);

        // 往原集合中添加元素
        bookList.add("早晨从中午开始");
// 修改子集合的值
//        luyaoBookList.set(1, "路遥-平凡的世界");
//        luyaoBookList.add("早晨从中午开始");

        System.out.println(bookList);
        System.out.println(luyaoBookList);

        new Thread().start();
    }

    @Test
    public void test() {
        List<String> bookList = new ArrayList<>();
        bookList.add("遥远的救世主");
        bookList.add("背叛");
        bookList.add("天幕红尘");
        bookList.add("人生");
        bookList.add("平凡的世界");

        List<String> luyaoBookList = bookList.subList(3, 30);
        System.out.println(luyaoBookList);
    }


}
